const express = require('express');
const paperMod= require('../module/paper');
const util =require('../util');
const  paperRouter= express.Router();
//  添加问卷
 paperRouter.post('/add',(req,res)=>{
     paperMod.addPaper(req.body,(PK_PaperGuid)=>{
         res.send({status:1,PK_PaperGuid});
     })
 });
 //获取所有问卷或者指定Guid的问卷
 paperRouter.get('',(req,res)=>{
    paperMod.getPaper(req.query.id,(data)=>{
        res.send({status:1,data});
    })
 })
 //删除指定guid的问卷
 paperRouter.delete('',(req,res)=>{
      if(!req.query.id){
          res.send({status:0,msg:'请传入需要删除问卷的id'});
          return
      }
      paperMod.deletePaper(req.query.id,(data)=>{
          res.send({status:1,data});
      })
 })
module.exports = paperRouter;